﻿using Coldairarrow.Entity;
using Coldairarrow.Entity.Goods;
using Coldairarrow.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;

namespace Coldairarrow.Business
{
    public interface IShop_CartBusiness
    {
        Task<PageResult<Shop_Cart>> GetDataListAsync(PageInput<ConditionDTO> input);

        Task<Shop_Cart> GetTheDataAsync(string id);

        Task AddDataAsync(Shop_Cart data);

        Task UpdateDataAsync(Shop_Cart data);

        Task DeleteDataAsync(List<string> ids);

        /// <summary>
        /// 添加购物车
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task AddDataTwoAsync(List<Shop_Cart> data);

        /// <summary>
        /// 获取购物车
        /// </summary>
        /// <returns></returns>
        Task<Shop_CartDtos> GetShopCart(PageInput<ShopCartd> input);

        /// <summary>
        /// 更新商品数量
        /// </summary>
        /// <returns></returns>
        Task UpdateNum(ShopCartNum cartNum);
    }

    public class ShopCartd
    {
        /// <summary>
        /// 是否特惠
        /// </summary>
        public bool? ishot { get; set; }

        /// <summary>
        /// 库存是否充足
        /// </summary>
        public bool? Invort { get; set; }
    }

    public class ShopCartNum
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        [Required]
        public string Id { set; get; }

        /// <summary>
        /// 购买数量
        /// </summary>
        [Required]
        public int Num { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        [Required]
        public decimal Price { get; set; }
    }

    public class Shop_CartDtos
    {
        public int Total { get; set; } = 0;

        /// <summary>
        /// 购物车产品数据
        /// </summary>
        public IEnumerable<Shop_CartDto> Data { get; set; }

        /// <summary>
        /// 合价
        /// </summary>
        public decimal? sumPrice { get; set; }
    }

    public class Shop_CartDto
    {
        public String Id { get; set; }

        /// <summary>
        /// CreatorId
        /// </summary>
        public String CreatorId { get; set; }

        /// <summary>
        /// CreateTime
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// Deleted
        /// </summary>
        public Boolean? Deleted { get; set; }

        /// <summary>
        /// 产品Id
        /// </summary>
        public String Products_Id { get; set; }

        /// <summary>
        /// 商品
        /// </summary>
        public GoodsDtom _Goods { get; set; }

        /// <summary>
        /// 商品图片
        /// </summary>
        public String GoodsPic { get; set; }

        /// <summary>
        /// 规格图片
        /// </summary>
        public String ItemPic { get; set; }

        ///// <summary>
        ///// 产品（商品规格）
        ///// </summary>
        //public GoodsItemDto _GoodsSpecificationsItem { get; set; }

        /// <summary>
        /// 购物车状态
        /// </summary>
        public String Cart_Start { get; set; }

        /// <summary>
        /// 购物车数量
        /// </summary>
        public Int32? ShopNum { get; set; }

        /// <summary>
        /// 库存量
        /// </summary>
        public Int32? Stock { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        public Decimal? SumPrice { get; set; }

        /// <summary>
        /// 单品总价格
        /// </summary>
        public Decimal? TotalPrice { get; set; }
    }

    /// <summary>
    /// 产品
    /// </summary>
    public class GoodsDtom
    {
        public String ID { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public String CreatorId { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public String GoodsName { get; set; }

        /// <summary>
        /// 商品类型id
        /// </summary>
        public String GoodsTypeId { get; set; }

        /// <summary>
        /// 品牌id
        /// </summary>
        public String Supplierid { get; set; }

        /// <summary>
        /// 商品描述
        /// </summary>
        public String GoodsDescribe { get; set; }

        /// <summary>
        /// 访问次数
        /// </summary>
        public int NumberOfVisits { get; set; }

        /// <summary>
        /// 商品图片
        /// </summary>
        public String GoodsPic { get; set; }

        /// <summary>
        /// 规格图片
        /// </summary>
        public String ItemPic { get; set; }

        /// <summary>
        /// 商品卖点
        /// </summary>
        public String GoodsSellingPoint { get; set; }

        /// <summary>
        /// GoodsRuleid
        /// </summary>
        public Int32? GoodsRuleid { get; set; }

        /// <summary>
        /// 商品价格
        /// </summary>
        public Decimal? GoodsPrice { get; set; }

        /// <summary>
        /// 是否热销
        /// </summary>
        public Boolean? IsHot { get; set; }

        /// <summary>
        /// 商品详情
        /// </summary>
        public String Details { get; set; }

        /// <summary>
        /// 规格参数id
        /// </summary>
        public Int32? Parameterid { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 编辑人
        /// </summary>
        public String Editor { get; set; }

        /// <summary>
        /// 编辑时间
        /// </summary>
        public DateTime? EditTime { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public Boolean? Deleted { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public GoodsItemDto _GoodsSpecificationsItem { get; set; }
    }

    /// <summary>
    /// 规格Id
    /// </summary>
    public class GoodsItemDto
    {
        public String GoodsSpecificationsItemID { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public String CreatorId { get; set; }

        /// <summary>
        /// 商品ID
        /// </summary>
        public String GoodsID { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public String Specs { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        public Decimal? Price { get; set; }

        /// <summary>
        /// 库存
        /// </summary>
        public Int32? Inventory { get; set; }

        /// <summary>
        /// 规格编码
        /// </summary>
        public String SpecsCode { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 编辑人
        /// </summary>
        public String Editor { get; set; }

        /// <summary>
        /// 编辑时间
        /// </summary>
        public DateTime? EditTime { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public Boolean? Deleted { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        public List<BTB_GoodsPic> BTB_GoodsPic { get; set; }
    }
}